﻿<UserControl x:Class="Quizio.Views.Rankings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="700"
             DataContext="{Binding RankingViewModel}">
    
    <Grid Style="{StaticResource ContentRoot}">
        <TextBlock Text="Rankings" Style="{StaticResource Heading2}" />
        <ScrollViewer Margin="0,40,0,0">
            <StackPanel MinWidth="200">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"></ColumnDefinition>
                        <ColumnDefinition Width="200"></ColumnDefinition>
                        <ColumnDefinition Width="200"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Content="Position" HorizontalAlignment="Left"/>
                    <Label Grid.Row="0" Grid.Column="1" Content="Spieler" HorizontalAlignment="Center"/>
                    <Label Grid.Row="0" Grid.Column="2" Content="Punkte" HorizontalAlignment="Right"/>
                </Grid>
                <ListBox ItemsSource="{Binding Aggregator.Rankings}" Width="620" Margin="0,20" HorizontalAlignment="Left">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="200"></ColumnDefinition>
                                        <ColumnDefinition Width="200"></ColumnDefinition>
                                        <ColumnDefinition Width="200"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Position}" HorizontalAlignment="Left"/>
                                    <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding PlayerName}" HorizontalAlignment="Center"/>
                                    <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Points}" HorizontalAlignment="Right"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
            </StackPanel>
        </ScrollViewer>
     </Grid>
</UserControl>